<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>async/await语法</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
    <div id="app">
    </div>
    <script>
        const myPromise=new Promise((resolve,rejrect)=>{
            //异步操作
            const success=true;
            if(success){
                resolve("操作成功");
            }else{
                reject("操作失败");
            }
        });
        async function asyncFunction(){
            try{
                const result=await myPromise;
                console.log(result);
            }catch(error){
                console.log(error);
            }
        }
        asyncFunction();
    </script>
</body>
</html>
